package com.room.search.web.rest;

import com.room.search.core.page.TableDataInfo;
import com.room.search.domain.RoomNotice;
import com.room.search.repository.RoomNoticeRepository;
import com.room.search.service.dto.RoomNoticeDTO;
import com.room.search.util.PageUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * By   : ghd.bright
 * Time : 2022/4/5
 * Description:
 */

@RestController
@RequestMapping("/api")
public class RoomNoticeResource {

    private final RoomNoticeRepository roomNoticeRepository;

    public RoomNoticeResource(RoomNoticeRepository roomNoticeRepository) {
        this.roomNoticeRepository = roomNoticeRepository;
    }

    @GetMapping("/notice/list")
    public TableDataInfo getNoticeAll(RoomNoticeDTO dto) {
        Pageable pageable = PageUtils.startPage();
        Page<RoomNotice> all = roomNoticeRepository.findAll(pageable);
        return TableDataInfo.getTableDataInfo(all);
    }
}
